#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
		}
		int sum = a[1];
		for (int i = 1; i <= n; i++) {
			sum &= a[i];
			if (!sum) {
				ans++;
				sum = a[i + 1];
			}
		}
		cout << max(1, ans) << endl;
	}
	return 0;
}